﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Quickly.Spa.Shared
{
    public sealed class SpaDevelopmentServerOptions : Dictionary<string, SpaDevelopmentServerOption>
    {

    }

    public sealed class SpaDevelopmentServerOption
    {
        public string ServerUrl { get; set; } = "";
        public string? RedirectUrl { get; set; }

        public string GetRedirectUrl()
        {
            if (string.IsNullOrWhiteSpace(RedirectUrl) == false)
            {
                return RedirectUrl;
            }

            return ServerUrl;
        }

        public string LaunchCommand { get; set; } = "";
        public int MaxTimeoutInSeconds { get; set; }
        public TimeSpan MaxTimeout => TimeSpan.FromSeconds(MaxTimeoutInSeconds);
        public string WorkingDirectory { get; set; } = "";
        public bool KeepRunning { get; set; }

        public string[] MatchPaths { get; set; }
    }
}


